Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 7, 2025

Implements a BeamNG.drive mod that integrates with the existing MSAgent-AI Named Pipe API to provide real-time AI commentary on driving events (vehicle changes, crashes, damage, surroundings).

Architecture

BeamNG.drive (Lua) → HTTP → Bridge Server (Python) → Named Pipe → MSAgent-AI (C#/.NET)
  • BeamNG Mod (beamng-mod/): Lua extension that monitors vehicle state, detects crashes via sudden deceleration, tracks damage accumulation, and sends events via HTTP
  • Bridge Server (beamng-bridge/bridge.py): Flask HTTP server that translates game events into Named Pipe commands (CHAT: prompts) for the existing MSAgent-AI pipeline
  • Integration: Leverages merged MSAgent-AI desktop app's PipelineServer.cs and Ollama AI backend

Event Detection

Crash detection uses configurable thresholds:

local crashSpeedDelta = 30  -- km/h speed loss threshold
local crashEndSpeed = 10    -- max final speed after crash

if speedDelta > crashSpeedDelta and env.speed < crashEndSpeed then
  sendToAI("/crash", {vehicle_name = name, speed_before = prevSpeed})
end

Damage differentiation:

  • Major damage (>0.1): /dent endpoint
  • Minor damage (<0.1): /scratch endpoint

Setup

Windows users run beamng-bridge/setup.bat and start.bat, then install mod to %LOCALAPPDATA%\BeamNG.drive\[version]\mods\msagent_ai\.

All communication is localhost-only (HTTP to 127.0.0.1:5000, Named Pipe IPC).

Documentation

  • QUICKSTART.md: Installation steps
  • ARCHITECTURE.md: Data flow diagrams, extension points
  • beamng-mod/README.md: Mod configuration, troubleshooting
Original prompt

Generate a BeamNG mod that will connect to this pipeline and have the AI comment on current happenings, for example, have it comment on the current car. Have it comment on the surroundings, have it comment when you crash, have it comment when you dent, when you scratch the paint


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits December 7, 2025 11:38
Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Co-authored-by: ExtCan <60326708+ExtCan@users.noreply.github.com>
Copilot AI changed the title [WIP] Add AI commentary feature for various events Add BeamNG.drive mod with AI commentary via MSAgent-AI pipeline Dec 7, 2025
Copilot AI requested a review from ExtCan December 7, 2025 11:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants